home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_msql.idb / usr / freeware / msql / tests / cachetest.z / cachetest
Text File  |  1998-10-27  |  3KB  |  103 lines

  1. #!/bin/sh
  2. #
  3. #  This script beats the internal table caching code around the ears a
  4. #  few times.  It constantly forces the caches to be rolled and
  5. #  reloaded.  Run it using "cachetest dbname" where dbname is a database
  6. #  that exists and doesn't have tables called test1 test2 or test3 in it.
  7. #
  8. #                            bambi
  9.  
  10. CREATE1="create table test1 ( name char(40), num int)"
  11. CREATE2="create table test2 ( name char(40), num int)"
  12. CREATE3="create table test3 ( name char(40), num int )"
  13. CREATE4="create table test4 ( name char(40), num int)"
  14. CREATE5="create table test5 ( name char(40), num int)"
  15. CREATE6="create table test6 ( name char(40), num int)"
  16. CREATE7="create table test7 ( name char(40), num int)"
  17. CREATE8="create table test8 ( name char(40), num int)"
  18. CREATE9="create table test9 ( name char(40), num int)"
  19. CREATE10="create table test10 ( name char(40), num int)"
  20. DROP1="drop table test1"
  21. DROP2="drop table test2"
  22. DROP3="drop table test3"
  23. DROP4="drop table test4"
  24. DROP5="drop table test5"
  25. DROP6="drop table test6"
  26. DROP7="drop table test7"
  27. DROP8="drop table test8"
  28. DROP9="drop table test9"
  29. DROP10="drop table test10"
  30. INSERT1="insert into test1 values ('Test1',1)"
  31. INSERT2="insert into test2 values ('Test2',2)"
  32. INSERT3="insert into test3 values ('Test3',3)"
  33. INSERT4="insert into test4 values ('Test4',4)"
  34. INSERT5="insert into test5 values ('Test5',5)"
  35. INSERT6="insert into test6 values ('Test6',6)"
  36. INSERT7="insert into test7 values ('Test7',7)"
  37. INSERT8="insert into test8 values ('Test8',8)"
  38. INSERT9="insert into test9 values ('Test9',9)"
  39. INSERT10="insert into test10 values ('Test10',10)"
  40.  
  41. NUM_CYCLES=40
  42. COUNT=0
  43. INDEX=1
  44. DB=$1
  45.  
  46. if test "$DB." = "."
  47. then
  48.         echo
  49.         echo "Bad usage.  Please read the intro to the script."
  50.         echo
  51.         exit 1
  52. fi
  53.  
  54. (
  55.     echo    "$DROP1 \p\g"
  56.     echo    "$DROP2 \p\g"
  57.     echo    "$DROP3 \p\g"
  58.     echo    "$DROP4 \p\g"
  59.     echo    "$DROP5 \p\g"
  60.     echo    "$DROP6 \p\g"
  61.     echo    "$DROP7 \p\g"
  62.     echo    "$DROP8 \p\g"
  63.     echo    "$DROP9 \p\g"
  64.     echo    "$DROP10 \p\g"
  65.  
  66.     echo    "$CREATE1 \p\g"
  67.     echo    "$CREATE2 \p\g"
  68.     echo    "$CREATE3 \p\g"
  69.     echo    "$CREATE4 \p\g"
  70.     echo    "$CREATE5 \p\g"
  71.     echo    "$CREATE6 \p\g"
  72.     echo    "$CREATE7 \p\g"
  73.     echo    "$CREATE8 \p\g"
  74.     echo    "$CREATE9 \p\g"
  75.     echo    "$CREATE10 \p\g"
  76.  
  77.     echo    "$INSERT1 \p\g"
  78.     echo    "$INSERT2 \p\g"
  79.     echo    "$INSERT3 \p\g"
  80.     echo    "$INSERT4 \p\g"
  81.     echo    "$INSERT5 \p\g"
  82.     echo    "$INSERT6 \p\g"
  83.     echo    "$INSERT7 \p\g"
  84.     echo    "$INSERT8 \p\g"
  85.     echo    "$INSERT9 \p\g"
  86.     echo    "$INSERT10 \p\g"
  87.  
  88.     while test $COUNT -lt $NUM_CYCLES
  89.     do
  90.         echo "select * from test1 \p\g"
  91.         echo "select * from test5 \p\g"
  92.         echo "select * from test2 \p\g"
  93.         echo "select * from test6 \p\g"
  94.         echo "select * from test3 \p\g"
  95.         echo "select * from test7 \p\g"
  96.         echo "select * from test4 \p\g"
  97.         echo "select * from test8 \p\g"
  98.         echo "select * from test10 \p\g"
  99.         echo "select * from test9 \p\g"
  100.         COUNT=`expr $COUNT + 1`
  101.     done
  102. ) | ../bin/msql $DB
  103.